/**
 * StringInputStream.java
 *
 *  charset : UTF-8
 *  created : 23.8.2011
 */
package utils;

import java.io.ByteArrayInputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

/**  
 * InputStream, který pouze zapisuje do řetězce.
 * 
 * @author Martin Pokorný
 * @version 0.1
 */
public class StringInputStream extends FilterInputStream {

    public StringInputStream(String source) {
        super(new ByteArrayInputStream(source.getBytes()));
    }

    public StringInputStream(String source, String charsetName) 
            throws UnsupportedEncodingException {
        super(new ByteArrayInputStream(source.getBytes(charsetName)));
    }    
    
    @Override
    public int read() throws IOException {
        return super.read();
    }
    
    @Override
    public int read(byte[] b) throws IOException {
        return super.read(b);
    }
    
    @Override
    public int read(byte[] b, int off, int len) throws IOException {
        return super.read(b, off, len);
    }

    
}
